<?php
/**
 * Created by PhpStorm.
 * User: 黄永宣
 * Date: 2017/12/20
 * Time: 16:26
 */

namespace App\Http\Model;


class ResponseResult
{
    public const RESET_USER = 303; //重新设置用户token

    /**
     * @param $msg
     * @param int $code
     * @return array
     */
    public static function success($msg, int $code = 0)
    {
        return ['success' => true, 'code' => $code, 'data' => $msg];
    }

    /**
     * @param int $code
     * @param $msg
     * @return array
     */
    public static function error(int $code, $msg)
    {
        return ['success' => false, 'code' => $code, 'data' => $msg];
    }

    /**
     * @param array $data
     * @return array
     */
    public static function customError(array $data)
    {
         $data['success'] = false;
         return $data;
    }


    /**
     * @param array $data
     * @return array
     */
    public static function customSuccess(array $data)
    {
        $data['success'] = true;
        return $data;
    }
}